package com.plian.system.wrapper.pf;

import com.plian.system.dto.pf.BaseExpenditureImplementationDTO;
import com.plian.system.entity.pf.BaseExpenditureImplementation;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.pf.BaseExpenditureImplementationVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;
import static com.plian.system.wrapper.util.WrapperConstant.USER_ID_TO_NAME;

@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface BaseExpenditureImplementationWrapper extends BaseWrapper<BaseExpenditureImplementation, BaseExpenditureImplementationDTO, BaseExpenditureImplementationVO> {

    @Override
    @Mappings(value = {
            @Mapping(source = "fillingUnitId", target = "fillingUnitName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME)
    })
    BaseExpenditureImplementationVO entityToVO(BaseExpenditureImplementation entity);
}
